package com.joysuch.wwyt.streampusher;

import com.joysuch.wwyt.streampusher.publisher.StreamPusher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

/**
 * 推流器包装类
 * 主要为了记录推流器的状态
 * @author qingzhou
 *         2017-11-08 12:25
 */
public class StreamPusherWrapper implements Serializable{

    private static final Logger logger = LoggerFactory.getLogger(StreamPusherWrapper.class);
    /**
     * 视频流
     */
    private StreamPusher publisher;
    /**
     * 上次呼吸时间
     */
    private long lastBreathTime;

    /**
     * 刷新呼吸
     */
    public void brease() {
        logger.info(this.publisher.identify() + " breathing...");
        this.lastBreathTime = System.currentTimeMillis();
    }

    public StreamPusherWrapper(StreamPusher publisher) {
        this.publisher = publisher;
    }

    public StreamPusher getPublisher() {
        return publisher;
    }

    public void setPublisher(StreamPusher publisher) {
        this.publisher = publisher;
    }

    public long getLastBreathTime() {
        return lastBreathTime;
    }

    public void setLastBreathTime(long lastBreathTime) {
        this.lastBreathTime = lastBreathTime;
    }

}
